package com.jk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jk.dao.TemUserMapper;
import com.jk.dto.TemUser;
import com.jk.service.TemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @author yzf
 * @version 1.0
 * @ClassName TemUserServiceImpl
 * @program: office
 * @description: TODO
 * @date 2025/2/13 11:36
 */
@Service
public class TemUserServiceImpl implements TemUserService {

    @Autowired
    private TemUserMapper adminMapper;

    @Override
    public TemUser findTemUserByUserName(String username) {
        QueryWrapper<TemUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_name", username);
        TemUser tbAdmin = adminMapper.selectOne(queryWrapper);
        if (Objects.isNull(tbAdmin)) {
            throw new RuntimeException("用户信息不存在！");
        }
        return tbAdmin;
    }
}
